<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>伪元素使用场景</title>
    <style>
      /* 场景一 */
      /* 字体声明 */
      @font-face {
        font-family: "icomoon";
        src: url("fonts/icomoon.eot?afruye");
        src: url("fonts/icomoon.eot?afruye#iefix") format("embedded-opentype"),
          url("fonts/icomoon.ttf?afruye") format("truetype"),
          url("fonts/icomoon.woff?afruye") format("woff"),
          url("fonts/icomoon.svg?afruye#icomoon") format("svg");
        font-weight: normal;
        font-style: normal;
        font-display: block;
      }
      .fon {
        position: relative;
        width: 200px;
        height: 35px;
        border: 1px solid red;
      }
      .fon::after {
        position: absolute;
        top: 10px;
        right: 10px;
        font-family: "icomoon";
        /* content: ""; */
        content: "\e903";
        font-size: 18px;
        color: red;
      }

      /* 场景二 */
      .tudou {
        position: relative;
        width: 444px;
        height: 320px;
        margin: 20px auto;
      }
      .tudou img {
        width: 100%;
        height: 100%;
      }
      .tudou::before {
        content: "";
        /* 隐藏遮罩层 */
        display: none;
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        background: rgba(0, 0, 0, 0.4) url(image/arr.png) no-repeat center;
      }
      /* 当我们鼠标经过土豆这个盒子，就让里面的before遮罩层示出来 */
      .tudou:hover::before {
        /* 显示遮罩层 */
        display: block;
      }
    </style>
  </head>
  <body>
    <!-- 场景一 -->
    <div class="fon"></div>

    <!-- 场景二 -->
    <div class="tudou">
      <img src="../土豆网/image/image1.00.webp" />
    </div>
  </body>
</html>
